﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace CanDichVU
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute("Register",
                            "dang-ky-thanh-vien",
                            new { controller = "Account", action = "Register" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("Login",
                            "dang-nhap-thanh-vien",
                            new { controller = "Account", action = "Login" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("CateDVDetails",
                            "dich-vu/{cateid}/{name}/{page}",
                            new { controller = "Cate", action = "CateDVDetails" },
                            new { cateid = @"\d+", name = @"([a-z0-9\.-]+)", page = @"\d+" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("CateDVDetailsFirstPage",
                            "dich-vu/{cateid}/{name}",
                            new { controller = "Cate", action = "CateDVDetails" },
                            new { cateid = @"\d+", name = @"([a-z0-9\.-]+)" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("PostNews",
                            "dang-tin-rao-vat",
                            new { controller = "Post", action = "PostNews" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("PostDetails",
                            "rao-vat/{id}/{name}",
                            new { controller = "Post", action = "PostDetails" },
                            new { id = @"\d+", name = @"([a-z0-9\.-]+)" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("QuanHuyenDetailsFirstPage",
                            "rao-vat-tai/{cateID}/{id}/{name}",
                            new { controller = "TinhThanh", action = "QuanHuyenDetails" },
                            new { cateID = @"\d+", id = @"\d+", name = @"([a-z0-9\.-]+)" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("QuanHuyenDetails",
                            "rao-vat-tai/{cateID}/{id}/{name}/{page}",
                            new { controller = "TinhThanh", action = "QuanHuyenDetails" },
                            new { cateID = @"\d+", id = @"\d+", name = @"([a-z0-9\.-]+)", page = @"\d+" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("TinhThanhDetailsFirstPage",
                            "rao-vat-tai/{id}/{name}/{page}",
                            new { controller = "TinhThanh", action = "TinhThanhDetails" },
                            new { id = @"\d+", name = @"([a-z0-9\.-]+)", page = @"\d+" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute("TinhThanhDetails",
                            "rao-vat-tai/{id}/{name}",
                            new { controller = "TinhThanh", action = "TinhThanhDetails" },
                            new { id = @"\d+", name = @"([a-z0-9\.-]+)" },
                            new[] { "CanDichVU.Controllers" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}